<template>
  <el-table 
    :data="myArr"
    border
    style="width: 100%">
    <el-table-column
      prop="num"
      label="编号"
      width="50">
    </el-table-column>
    <el-table-column
      prop="odd"
      label="单号"
      width="150">
    </el-table-column>
    <el-table-column
      prop="title"
       width="200"
      label="标题">
    </el-table-column>
    <el-table-column
      prop="name"
      label="报警人"
      width="100">
    </el-table-column>
    <el-table-column
      prop="time"
      width="150"
      label="报警时间">
    </el-table-column>
     <el-table-column
      prop="address"
       width="150"
      label="案发地址">
    </el-table-column>
    <el-table-column
      prop="police"
      label="接警员">
      <template slot-scope="scope">
       <span>  {{ policeObj[scope.row.police] }} </span>
        </template>
    </el-table-column>
     <el-table-column
      prop="policeMan"
      label="被派警员">
    </el-table-column>
    <el-table-column
      prop="state"
      label="状态">
        <template slot-scope="scope">
       <span>  {{ typeObj[scope.row.type] }} </span>
        </template>
    </el-table-column>
     <el-table-column
      prop="operator"
      label="操作">
       <template slot-scope="scope">
       <el-button
          size="mini"
          type="danger"
          @click="handleDelete( scope.row.id)">删除</el-button>
        </template>
    </el-table-column>
    <el-table-column
      prop=""
      label="反馈内容">
    </el-table-column>
  </el-table>
  
</template>

<script>
import { deleteByIdApi } from '../../../api/homeApi'
  export default {
    props:['myArr'],
    data() {
      return {
         policeObj:{
          1:'接警员1',
          2:'接警员2',
          3:'接警员3',
          4:'接警员4',
          5:'接警员5',
          6:'接警员6',
        },
           typeObj:{
          0:'已处理',
          1:'未处理',
          2:'以派警',
        },
        // tableData: [{
         
        //   num:1,
        //   odd: 15525434,
        //   title: '延安高架多车连环相撞',
        //   time: '2019-10-10 10:10:10',
        //   address:'上海市浦东新区666号',
        //   police:3,
        //   policeMan:2141140,
        //   type:1,
        //   operator:'查看'
        
        // }]
      }
    },
    methods:{
      handleDelete(id){
     deleteByIdApi({id:id}).then(res=>{
          console.log(res)
          if(res.code==200){
            this.$emit('resetTable')//刷新表格
          }
        })
    }
    }
    
  }
</script>

<style lang="less">
.el-table{
  margin-top: 50px;
}

</style>